package com.gomro.galaxy.foundation.bi.acquisition;

import com.gomro.galaxy.core.commons.response.RestResponse;
import com.gomro.galaxy.foundation.bi.api.AcquisitionApi;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//采集控制器
@Slf4j
@RestController
@RequestMapping("acquisition")
public class AcquisitionController implements AcquisitionApi {

    private AcquisitionService acquisitionService;

    public AcquisitionController(AcquisitionService acquisitionService) {

        this.acquisitionService = acquisitionService;
    }

    @Override
    public RestResponse<Boolean> run(String acquirePlan, String ver) {
            boolean ret = acquisitionService.run(acquirePlan, ver);
            return RestResponse.success(ret ? 1 : 0, ret);
    }
}
